package o;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.RemoteBuoyAction;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.fastengine.fastview.download.utils.PackageUtils;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import com.huawei.gamebox.plugin.gameservice.view.TransferActivity;
import o.cii.c;

public class bez implements c {
    public void ˏ(Context context, BaseCardBean baseCardBean) {
        if (context == null || baseCardBean == null) {
            Logger.e("BuoyCardDetailListener", "null == context || !(bean instanceof BuoyBaseCardBean)");
            return;
        }
        fae ˏ = fam.ॱ().ˏ();
        if (ˏ != null) {
            GameInfo gameInfo = ˏ.getGameInfo();
            Bundle bundle = new Bundle();
            bundle.putString("SEGMENT_URI", baseCardBean.ॱॱ());
            bundle.putString("APPID", TextUtils.isEmpty(baseCardBean.ͺˏ()) ? gameInfo.getAppId() : baseCardBean.ͺˏ());
            bundle.putString("PACKAGENAME", gameInfo.getPackageName());
            bundle.putBoolean("NEED_OBSERVE_ACC", true);
            ॱ(context, bundle, baseCardBean);
            bgi.ˋ().ˏ(baseCardBean.u_() + "_" + UserSession.getInstance().getUserId());
            return;
        }
        Logger.e("BuoyCardDetailListener", "buoyBridge == null");
    }

    private void ॱ(Context context, Bundle bundle, BaseCardBean baseCardBean) {
        if (eqp.ᐝ() && ˋ() == 2 && !PackageUtils.HWGAMEBOX_PACKAGE_NAME.equals(context.getPackageName())) {
            Intent intent = new Intent(context, TransferActivity.class);
            intent.setAction(RemoteBuoyAction.RESUME_GAMEBOX_ACTION);
            intent.putExtra(RemoteBuoyAction.REMOTE_BUOY_URI, "buoy_gss");
            intent.putExtra(RemoteBuoyAction.REMOTE_BUOY_PARAM, bundle);
            String ॱॱ = baseCardBean.ॱॱ();
            intent.putExtra(RemoteBuoyAction.RESTORE_REPORTBI_URI, ॱॱ);
            if (!dof.ˋ(ॱॱ) && ॱॱ.startsWith("buoy_gss|commodity")) {
                intent.putExtra(RemoteBuoyAction.RESTORE_TARGET_VERSION, 100300000);
            }
            fam.ॱ().ˎ(context, TransferActivity.class, intent, true);
            return;
        }
        fam.ॱ().ˏ(context, new bhk(context), bundle);
    }

    private int ˋ() {
        ezo ˊ = ˊ();
        if (ˊ != null) {
            return ˊ.ᐝ();
        }
        return 0;
    }

    private ezo ˊ() {
        GameInfo gameInfo = null;
        fae ˏ = fam.ॱ().ˏ();
        if (ˏ != null) {
            gameInfo = ˏ.getGameInfo();
        }
        return ezs.ˏ().ˋ(gameInfo);
    }
}
